const express = require("express");
const workplaceService = require("../services/workplace");

let router = express.Router();

router.get("/projects", async (req, res, next) => {
    try {
        const result = await workplaceService.getProject();
        res.send({code: 200, msg: "请求成功", data: result});
    } catch(e) {
        next(e);
    }
});

router.get("/activities", async (req, res, next) => {
    try {
        const result = await workplaceService.getActivity();
        res.send({code: 200, msg: "请求成功", data: result});
    } catch (e) {
        next(e)
    }
});

router.get("/teams", async (req, res, next) => {
    try {
        const result = await workplaceService.getTeam();
        res.send({code: 200, msg: "请求成功", data: result});
    } catch (e) {
        next(e);
    }
});

module.exports = router;
